package com.nf.test;

import java.util.Properties;

public class 测试类 {

    public static void main(String[] args) throws Exception {

        Properties p = new Properties();
        p.load(  测试类.class.getResourceAsStream("/bean.properties")  );
        //System.out.println( p.get("computer")  );
        //System.out.println( p.get("printer")  );

        电脑 computer = (电脑) Class.forName(p.get("computer").toString()).newInstance();
        打印机 printer = (打印机) Class.forName(p.get("printer").toString()).newInstance();
        computer.setPrinter(printer);
        computer.打印文本("hello 140");
        //创建电脑
        //电脑 computer = new 电脑();
        //打印机 printer = new 黑白打印机();
        //打印机 printer = new 彩色打印机();
        //computer.setPrinter(printer);

        //computer.打印文本("hello 140");
    }
}
